﻿using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;

namespace Ya.Router
{
    public static class ApplicationBuilderExtension
    {
        public static IApplicationBuilder UseMultiRouterMiddleWare(this IApplicationBuilder app, IHostingEnvironment env)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }
            ProcessorFactory.Init(env);
            return app.UseMiddleware<MultiRouterMiddleWare>();
        }
    }
}
